<template>
  <base-paenl>
    <div slot="header">
      全屋基本信息
      <div class="release">
        <img
          src="../../assets/images/panels/wenhaotubiao.png"
          width="14px"
          height="14px"
          style="cursor: pointer;"
        />
        <span class="release-text" @click="handleClick('Creleaserecord')">房源发布记录</span>
      </div>
    </div>
    <div slot="main" class="slot-main">
      <div v-for="(item, index) of dataList" :key="index">
        <div class="panel-second-row5">
          <div class="panel-row-title">
            {{ item.name }}
          </div>
          <div class="panel-row-main">
            <div v-if="item.name == '产权人'">
              <el-scrollbar style="height: 80px">
                <div
                  v-for="(subitem, subindex) in item.value"
                  :key="subindex"
                  class="panel-row-content"
                >
                  {{ subitem.xm }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{
                    subitem.sfz
                  }}
                </div>
              </el-scrollbar>
            </div>
            <div v-if="item.name == '房屋套型'" class="panel-row-content">
              {{ item.value }}
            </div>
            <div v-if="item.name == '租间列表'">
              <div class="house-type-header">
                <div class="col col1">房间名称</div>
                <div class="col col2">面积（平方米）</div>
                <div class="col col3">租金（元）</div>
                <div class="col col4">朝向</div>
              </div>
              <el-scrollbar style="height: 110px">
                <div
                  v-for="(subitem, subindex) in item.value"
                  :key="subindex"
                  class="house-type-row"
                >
                  <div class="col col1">{{ subitem.zjmc }}</div>
                  <div class="col col2">{{ subitem.mj }}</div>
                  <div class="col col3">
                    {{ subitem.zj }}
                  </div>
                  <div class="col col4">{{ subitem.cx }}</div>
                </div>
              </el-scrollbar>
            </div>
          </div>
        </div>
      </div>
    </div>
  </base-paenl>
</template>

<script lang="ts">
import { Vue, Component, Watch } from "vue-property-decorator";
import BasePaenl from "./CBase.vue";
import exportVue from "@/assets/modules/exportVue";

@Component({
  name: "CWholeHouseInformation",
  components: { BasePaenl }
})
export default class extends Vue {
  dataList: any = [];
  mounted() {
    const win: any = window;
    const _this = this;
    exportVue.$on("initFloor", (item: any) => {
      _this.dataList = win.dataConfig.wholeHouseInformation;
      if (item) {
        // 暂时写假数据 
        const randomKey = Math.floor(Math.random() * 4);
        const values = win.dataConfig.wholeHouseInformationValue;
        _this.dataList.cqr.value = item.cqrs; 
        _this.dataList.fwtx.value = item.fwtx;
        _this.dataList.zjlb.value = item.zjlbs;
      }
    });
  }
  handleClick(type: string) {
    this.$store.commit("panel/setDialogShow", true);
    this.$store.commit("panel/setDialog", type);
  }
}
</script>

<style lang="scss" scoped>
.release {
  display: inline-flex;
  align-items: center;
  margin-left: 140px;
  .release-text{
  font-family: AlibabaPuHuiTi_2_65_Medium;
  font-size: 14px;
  line-height: 22px;
  color: #ffffff;
  }
}

.slot-main {
  height: 346px;
  .panel-second-row5 {
    .panel-row-title {
      width: 388px;
      height: 17px;
      margin-bottom: 10px;
    }
    .panel-row-main {
      margin-bottom: 10px;
    }
    .panel-row-content {
      width: 395px;
      height: 37px;
      background-image: url(../../assets/images/panels/biaogekuang.png);
      background-size: 100% 100%;
      padding: 10px 15px;
      margin-bottom: 5px;
    }
  }
  .house-type-header {
    width: 396px;
    height: 32px;
    background-image: url(../../assets/images/dialogs/tuanchuangbiaotoudikuan.png);
    background-size: 100% 100%;
    display: flex;
    align-items: center;
    .col {
      font-family: AlibabaPuHuiTi_2_55_Regular;
      font-size: 14px;
      line-height: 44px;
      color: #ffffff;
    }
  }
  .house-type-row {
    width: 396px;
    height: 32px;
    background-color: rgba(5, 61, 122, 0.25);
    display: flex;
    align-items: center;
    margin: 2px 0;
    .col {
      font-family: AlibabaPuHuiTi_2_55_Regular;
      font-size: 12px;
      line-height: 44px;
      color: #b4d8f7;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }
  .col1 {
    width: 99px;
    text-align: center;
  }
  .col2 {
    width: 99px;
    text-align: center;
  }
  .col3 {
    width: 99px;
    text-align: center;
  }
  .col4 {
    width: 99px;
    text-align: center;
  }
}
</style>
<style lang="scss"></style>
